package chapter02;

import java.util.Scanner;

public class Training09 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入班级人数");
        int num = sc.nextInt();
        double[] score = new double[num];
        int gt80 = 0;
        int gt70 = 0;
        int gt60 = 0;
        int lt60 = 0;
        double sum = 0;
        for (int i = 0;i<score.length;i++){
            System.out.print("请输入学号是"+(i + 1) + "学生的成绩：");
            score[i]=sc.nextDouble();
            sum = sum + score[i];
            if (score[i]>=80){
                gt80++;
            }else  if (score[i] >= 70) {
                gt70++;
            }else if (score[i] >= 60) {
                gt60++;
            }else  if (score[i] >= 0){
                lt60++;
            }else {
                System.out.println("第" + (i + 1) + "成绩格式错误");
            }
        }
        double avg = sum / score.length;
        System.out.println("全班平均成绩为:" + avg);
        System.out.println("成绩大于80分:" + gt80);
        System.out.println("成绩大于70分:" + gt70);
        System.out.println("不及格人数为:" + gt60);


    }
    }

